
# import numpy as np
# from matplotlib import pyplot as plt

import zhipuai as zp
from zhipuai import ZhipuAI

client = ZhipuAI(
    api_key="fc9ec95eab45444375e09f5ea635ecf9.XCxxzvu4R5tDJXfI", # 填写您的 APIKey
)
messages = [
    {"role": "user", "content": "作为一名营销专家，请为我的产品创作一个吸引人的slogan"},
    {"role": "assistant", "content": "当然，为了创作一个吸引人的slogan，请告诉我一些关于您产品的信息"},
    {"role": "user", "content": "智谱AI开放平台"},
    {"role": "assistant", "content": "智启未来，谱绘无限一智谱AI，让创新触手可及!"},
    {"role": "user", "content": "创造一个更精准、吸引人的slogan"}
]
response = client.chat.completions.create(
  model="glm-4-flashx",  # 填写需要调用的模型名称
  messages = messages
)
a = response.choices[0].message.content
print(a)
# if __name__ == '__main__':
    # phi1 = lambda x: 1/np.pi * np.arctan(np.pi*x) + 0.5
    # phi2 = lambda x: np.arctan(x)
    # x = np.linspace(-1, 1, 200)
    # y1 = phi1(x)
    # y2 = phi2(x)
    # y = x > 0
    # plt.plot(x, y,x,y1,x,y2)
    # legends = ['Heaviside step function',r'$\dfrac{1}{\pi} \mathrm{arctan}(\pi x) + \dfrac{1}{2}$',r'$\mathrm{arctan}(x)$']
    # plt.legend(legends,frameon=False)
    # plt.show()

